package com.ssyc.gsk_teacher.adapter;

import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.ssyc.common.adapter.CommonAdapter;
import com.ssyc.common.adapter.ViewHolder;
import com.ssyc.common.glide.ImageUtil;
import com.ssyc.common.view.XCRoundRectImageView;
import com.ssyc.gsk_teacher.R;
import com.ssyc.gsk_teacher.bean.StudentQueryInfo;

import java.util.List;

/**
 * 查询练习布置情况
 */

public class WorkQuerySutdentGvAdapter extends CommonAdapter<StudentQueryInfo.DataBean> {

    private Context context;

    public WorkQuerySutdentGvAdapter(Context context, List<StudentQueryInfo.DataBean> datas, int layoutId) {
        super(context, datas, layoutId);
        this.context = context;
    }

    @Override
    public void convert(ViewHolder holder, final StudentQueryInfo.DataBean listBean) {
        //头像
        XCRoundRectImageView lvHead = holder.getView(R.id.lv_head);
        XCRoundRectImageView lv_gary = holder.getView(R.id.lv_gary);
        if("0".equals(listBean.getSTATUS())){
        if(!TextUtils.isEmpty(listBean.getIcon())){
            ImageUtil.displayImage(context,lvHead,listBean.getIcon(),R.drawable.base_default_head);
        }
        }else{
            //灰色
            lv_gary.setVisibility(View.VISIBLE);
        }
        //名称
        TextView tvName = holder.getView(R.id.tv_name);

        tvName.setText(listBean.getName());
        //外层选中
        LinearLayout llOut = holder.getView(R.id.ll_out);

        //状态
        ImageView lvState = holder.getView(R.id.lv_delete);

        RelativeLayout rl_img_bg = holder.getView(R.id.rl_img_bg);
        //根据选中状态设置选中状态的值
            lvState.setVisibility(View.INVISIBLE);
            rl_img_bg.setBackgroundResource(R.color.transparent);
    }
}
